{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9165aff8-6210-4dd1-ace5-eaaf8a433162",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz\n",
      "\u001b[1m11490434/11490434\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m7s\u001b[0m 1us/step \n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Administrator\\anaconda3\\Lib\\site-packages\\keras\\src\\layers\\reshaping\\flatten.py:37: UserWarning: Do not pass an `input_shape`/`input_dim` argument to a layer. When using Sequential models, prefer using an `Input(shape)` object as the first layer in the model instead.\n",
      "  super().__init__(**kwargs)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\">Model: \"sequential\"</span>\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1mModel: \"sequential\"\u001b[0m\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃<span style=\"font-weight: bold\"> Layer (type)                         </span>┃<span style=\"font-weight: bold\"> Output Shape                </span>┃<span style=\"font-weight: bold\">         Param # </span>┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Flatten</span>)                    │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">784</span>)                 │               <span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                        │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">128</span>)                 │         <span style=\"color: #00af00; text-decoration-color: #00af00\">100,480</span> │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_1 (<span style=\"color: #0087ff; text-decoration-color: #0087ff\">Dense</span>)                      │ (<span style=\"color: #00d7ff; text-decoration-color: #00d7ff\">None</span>, <span style=\"color: #00af00; text-decoration-color: #00af00\">10</span>)                  │           <span style=\"color: #00af00; text-decoration-color: #00af00\">1,290</span> │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n",
       "</pre>\n"
      ],
      "text/plain": [
       "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓\n",
       "┃\u001b[1m \u001b[0m\u001b[1mLayer (type)                        \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mOutput Shape               \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1m        Param #\u001b[0m\u001b[1m \u001b[0m┃\n",
       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩\n",
       "│ flatten (\u001b[38;5;33mFlatten\u001b[0m)                    │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m784\u001b[0m)                 │               \u001b[38;5;34m0\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense (\u001b[38;5;33mDense\u001b[0m)                        │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m128\u001b[0m)                 │         \u001b[38;5;34m100,480\u001b[0m │\n",
       "├──────────────────────────────────────┼─────────────────────────────┼─────────────────┤\n",
       "│ dense_1 (\u001b[38;5;33mDense\u001b[0m)                      │ (\u001b[38;5;45mNone\u001b[0m, \u001b[38;5;34m10\u001b[0m)                  │           \u001b[38;5;34m1,290\u001b[0m │\n",
       "└──────────────────────────────────────┴─────────────────────────────┴─────────────────┘\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Total params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Total params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">101,770</span> (397.54 KB)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Trainable params: \u001b[0m\u001b[38;5;34m101,770\u001b[0m (397.54 KB)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"font-weight: bold\"> Non-trainable params: </span><span style=\"color: #00af00; text-decoration-color: #00af00\">0</span> (0.00 B)\n",
       "</pre>\n"
      ],
      "text/plain": [
       "\u001b[1m Non-trainable params: \u001b[0m\u001b[38;5;34m0\u001b[0m (0.00 B)\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "mnist=tf.keras.datasets.mnist\n",
    "(x_train,y_train),(x_test,y_test)=mnist.load_data()\n",
    "x_train,x_test=x_train/255.0,x_test/255.0\n",
    "model=tf.keras.models.Sequential()\n",
    "model.add(tf.keras.layers.Flatten(input_shape=(28,28)))\n",
    "model.add(tf.keras.layers.Dense(128,activation='relu'))\n",
    "model.add(tf.keras.layers.Dense(10,activation='softmax'))\n",
    "model.summary()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "79a6bd37-9ab1-4c9a-b4e7-8f62606470ad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 831us/step - loss: 0.2585 - sparse_categorical_crossentropy: 0.2585\n",
      "Epoch 2/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 798us/step - loss: 0.1134 - sparse_categorical_crossentropy: 0.1134\n",
      "Epoch 3/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 794us/step - loss: 0.0782 - sparse_categorical_crossentropy: 0.0782\n",
      "Epoch 4/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m1s\u001b[0m 790us/step - loss: 0.0571 - sparse_categorical_crossentropy: 0.0571\n",
      "Epoch 5/5\n",
      "\u001b[1m1875/1875\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m2s\u001b[0m 812us/step - loss: 0.0456 - sparse_categorical_crossentropy: 0.0456\n",
      "313/313 - 0s - 836us/step - loss: 0.0782 - sparse_categorical_crossentropy: 0.0782\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[0.07822271436452866, 0.07822271436452866]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.compile(loss='sparse_categorical_crossentropy',optimizer='adam',metrics=['sparse_categorical_crossentropy'])\n",
    "model.fit(x_train,y_train,batch_size=32,epochs=5)\n",
    "model.evaluate(x_test,y_test,batch_size=32,verbose=2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "f64e53c9-a15e-4747-8502-3ad804b7e7e0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 61ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 31ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 33ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 32ms/step\n",
      "\u001b[1m1/1\u001b[0m \u001b[32m━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[37m\u001b[0m \u001b[1m0s\u001b[0m 32ms/step\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgQAAACQCAYAAAB3anPqAAAAOnRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjEwLjAsIGh0dHBzOi8vbWF0cGxvdGxpYi5vcmcvlHJYcgAAAAlwSFlzAAAPYQAAD2EBqD+naQAAJppJREFUeJzt3XtYVNX+P/A3N0EBAUEI1NDUNBU1S1HzUmhalnkLzS7e8lZ9rcy7acbxHK1Mq1OWWWkq5LXQQBFT83Ys81JqoqJhpRRCoh7kMhh8fn/4c501wugMMMMw8349D09vtns2m/1xxtVae6/lIiICIiIicmqulX0CREREVPnYICAiIiI2CIiIiIgNAiIiIgIbBERERAQ2CIiIiAhsEBARERHYICAiIiJYuUHwxRdfYOvWrWV+fVxcHKZOnYq8vDyj7SKCCRMmYN++fbc8xpw5c7BkyRIUFxerbVlZWXj66aeRmJhY5nOrylgX+8Xa2C/Wxj6xLhXH3ZoHj4uLQ0REBLp37w4ASE1NhaurK7y8vIz2KyoqQm5uLpo1a6a25eXlYdq0afD19UX79u0BAPn5+ejXrx+SkpKwYMECtGnTBnXq1AEAGAwGhIaGokaNGuoYhYWFmDdvHrp27YrBgwfD09MTrq6uyM3NRVxcHAYMGGB0DkVFRahWrZrVroe9YF3sF2tjv1gb+8S6VCCxov79+8trr72mvm/VqpUAMPmlGzJkiNSoUUPq1q0r1atXl4iICGnUqJGcOXNGmjRpItWrV5caNWqIm5ub+Pv7i6enp+zYscPoGPHx8QJAfvjhBwkJCbnpzwYgEyZMKNPvOWjQIGnZsqX8/fffZXq9rTlyXQoKCmT06NESEhIivr6+EhUVJSkpKeW7YDbkyLXJy8uT5557TmrVqiXu7u5y9913y6FDh8p3wWzIUWtz5swZk8cIDw8v93WzNkety3Wpqakyfvx4efzxx2XGjBmSlZVV9ot1C1ZtEAwYMEBmzZqlvs/MzJScnByjfYqKiuTy5cuSnp4uIiK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ufvqq6+qbC/DBI5Kf7JAHybQ76jVnxQ4fPiwyvqCRrVq1VJZv/vd1DCBvp44AGzYsKHUn8H6G9OHYPSnCWbMmKGyPmMb3dyNXe36QjW+vr6lvqZfv34q6932+gybltIXttIzlZ+pJ0dufNKpNA8//LDK+oytene+PnwAlG+YoCzYQ0BERERsEBAREVEVHzLQu2A6duyosn6XuqkFXKjieXt7l7r977//VvnSpUsq65MG3X///SqbutNY75bT1yjv2bOn0X4nTpww63zpfz799FOV9UXAyHx33nmn0ff6MIH+d3rQoEEq613Q+lBNTEyMyqbeV/qQhH58U/vrNm7caPR9eZ4scET6vyemhi0NBoPKei10p06dUnngwIEq64tdrV27VuVRo0aV8YwrBnsIiIiIiA0CIiIiqoJDBvfdd5/KixcvVtnPz0/lrKwslfW58/W70a09V7Uzunr1aqnba9eurbK+vrcpev30u3G3b9+usv70AJWfvs7D/v37Ve7UqVNlnI5D0O8e//nnn1X+/vvvVdYn8NInMmrVqpXK+hoEOr07Wn8y55tvvil1f32SqXfeeeem5+6MmjdvrnJCQoLK/v7+KmdkZKisX/Nq1ard8vj6sM7mzZtV1ifMKywsNP+ErYA9BERERMQGAREREVWRIQN9wptvv/1WZXf30k9f76LWl9VdsWKFyvq84VR2jRo1Urlp06a33F+fo12fGGfJkiUqL1q0SOX8/PxyniFZSn/6o0ePHpV4JlWLPqQFAJ9//rnKM2fOVFl/QsYUfUjMnOExfTlwnf70gL4s/OXLl295TGejf5bpwwT6NdTXydGfCDBnyECnDyfddtttKutDd5WBPQRERETEBgERERFVkSEDfWlcfWIbfb787OxslfVu6bp166qsTwii372ekpJSYefqDCZPnqzyrFmzVDZn3vtffvlF5S5duqh843KsRFXNhQsXjL43Z4ntinL33Xfb7Gc5Kn1iKf2JgCZNmqisD4vqTwTs3btX5Q8//FDlnJwclfXPTX1SPX0isClTppTp3CsKewiIiIiIDQIiIiKqIkMG+lz4+pKTuvnz56v87rvvqqxPCNKgQQOVH3zwQZU5ZHBr//73v1XW7zzXhwn0u3H1Jwj0/fXJPAICAlTmkAGRZcLCwlR+9NFHVdaHT/VllB3xyYIaNWqUmsvis88+U1lfD8LT01NlfShBXyfn0KFDtzx+3759VdYn2DM18VRlYA8BERERsUFAREREVWTIQL8bPTg4WGV97vzk5GSV9cls9CcO9OVz9QmOqKTBgwcbfT98+HCV9a45falhfRgmNzdXZX1u/IYNG6r80EMPqfzxxx+X84zJUsOGDVN5wIABKj/yyCOl7v/HH3+orC/ZunDhQpW5jK51tW/fXmV9zQL9Pak/TbVu3TrbnJgN6UsQr1+/XmV9yeKb0bv99QmCfvjhB5X1NQs2bdqk8vHjx1U2Z5igqmEPAREREbFBQERERFVkyKB3796lbj979qzKelflHXfcUWr+7bffVD5y5EhFnqJDqF+/vsr6HbeA8Z228fHxKo8YMUJlU08K6E8ovPfeeyrrE3LoXdD6XdJUfrfffrvKehdr69atb/naixcvqqzPuT5u3DiVn3zySZX1u9337dtn6anSLehLHl+5ckXl8t5hX5XoT5FFRkaqrA9d6f82mKtbt24q65MU6fmnn35SWV8nxxR9TYS2bduWuo++7HVlYw8BERERsUFAREREVWTIwBT97nW9+2zMmDEqV69eXeXTp0/b5sSqEL0bWF8z4salpXv27Knyjh07VNYnjTJFf+JApw9DmFrKmspGHybYuHGjyvpkNv3791dZXz5X7zrVJ1Bp1qyZyvpQXK9evVTWhyRCQ0PLcup0E/od9vqSu3qN9eyI9K732NhYlV988cVyHXfevHnlev11+jBBQkKCyhERESrrTzRs27atQn5uRWAPAREREbFBQERERFV8yMDHx0dlfVKc119/XWV94onVq1fb5LyqkpdfflllvdtefyIDMJ6Qw5xhAjc3N5X1YQldo0aNVNbXOMjMzLzl8enm9K57vXtfvytbX+fj6aefVnnu3Lkq63drm7pz+6OPPlL5nnvuKdsJk0ktWrRQec6cOSrrXdMxMTEq6xOzOSL97n69G17/DLH1k0r6ssjfffedyn5+firrQ9YzZsxQ2Z6eqmIPAREREbFBQERERFV8yKBz584q33XXXSrrS1fqd9wuXbrUNidWhehrQ+h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z+8SnDIiIiMhsbBAQERGR+UMGRERE5LjYQ0BERERsEBAREREbBERERAQ2CIiIiAhsEBARERHYICAiIiKwQUBERERgg4CIiIjABgEREREB+H8vTmGrew0AFAAAAABJRU5ErkJggg==",
      "text/plain": [
       "<Figure size 640x480 with 5 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "for i in range(5):\n",
    "    t=np.random.randint(1,10000)\n",
    "    x=tf.reshape(x_test[t],(1,28,28))\n",
    "    y_pred=np.argmax(model.predict(x),axis=1)\n",
    "    plt.subplot(1,5,i+1)\n",
    "    plt.rcParams['font.sans-serif']=['SimHei']\n",
    "    plt.axis(\"off\")\n",
    "    plt.imshow(x_test[t],cmap='gray')\n",
    "    title=\"标签值:\"+str(y_test[t])+\"\\n预测值:\"+str(y_pred[0])\n",
    "    plt.title(title)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6ff9dec3-cb50-4779-ba8f-11e15ebc797a",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
